@@ -71,6 +71,8 @@ If you need more detailed instructions, see the [Novice setup guide][novice-setu |
||
71 | 71 |
|
72 | 72 |
## Deployment |
73 | 73 |
|
74 |
+[](https://heroku.com/deploy) |
|
75 |
+ |
|
74 | 76 |
Huginn can run on Heroku for free! Please see [the Huginn Wiki](https://github.com/cantino/huginn/wiki#deploying-huginn) for detailed deployment strategies for different providers. |
75 | 77 |
|
76 | 78 |
### Optional Setup |
@@ -0,0 +1,23 @@ |
||
1 |
+{ |
|
2 |
+ "name": "Huginn", |
|
3 |
+ "description": "Build agents that monitor and act on your behalf. Your agents are standing by!", |
|
4 |
+ "website": "https://github.com/cantino/huginn", |
|
5 |
+ "repository": "https://github.com/cantino/huginn", |
|
6 |
+ "env": { |
|
7 |
+ "BUILDPACK_URL": "https://github.com/ddollar/heroku-buildpack-multi.git", |
|
8 |
+ "APP_SECRET_TOKEN": { |
|
9 |
+ "generator": "secret" |
|
10 |
+ }, |
|
11 |
+ "PROCFILE_PATH": "deployment/heroku/Procfile.heroku", |
|
12 |
+ "ON_HEROKU": "true", |
|
13 |
+ "FORCE_SSL": "true", |
|
14 |
+ "INVITATION_CODE": { |
|
15 |
+ "generator": "secret" |
|
16 |
+ }, |
|
17 |
+ "USE_GRAPHVIZ_DOT": "dot" |
|
18 |
+ }, |
|
19 |
+ "scripts": { |
|
20 |
+ "postdeploy": "bundle exec rake db:migrate" |
|
21 |
+ }, |
|
22 |
+ "success_url": "/users/sign_up" |
|
23 |
+} |
@@ -117,6 +117,37 @@ span.not-applicable:after { |
||
117 | 117 |
} |
118 | 118 |
} |
119 | 119 |
|
120 |
+// Heroku |
|
121 |
+ |
|
122 |
+.heroku-instructions { |
|
123 |
+ color: rgba(255, 255, 255, 0.9); |
|
124 |
+ background-color: rgba(132, 132, 196, 0.8); |
|
125 |
+ border: 3px solid rgba(132, 132, 196, 0.5); |
|
126 |
+ -webkit-border-radius: 4px; |
|
127 |
+ -moz-border-radius: 4px; |
|
128 |
+ border-radius: 4px; |
|
129 |
+ padding: 12px; |
|
130 |
+ margin-bottom: 10px; |
|
131 |
+ |
|
132 |
+ a { |
|
133 |
+ text-decoration: underline; |
|
134 |
+ } |
|
135 |
+ |
|
136 |
+ a:link { |
|
137 |
+ color: inherit; |
|
138 |
+ } |
|
139 |
+ |
|
140 |
+ a:hover, a:visited, a:active { |
|
141 |
+ color: #fff; |
|
142 |
+ } |
|
143 |
+ |
|
144 |
+ pre { |
|
145 |
+ background-color: #ffffff; |
|
146 |
+ color: #3F3F44; |
|
147 |
+ margin: 4px; |
|
148 |
+ } |
|
149 |
+} |
|
150 |
+ |
|
120 | 151 |
// Logs |
121 | 152 |
|
122 | 153 |
#logs .action-icon { |
@@ -7,6 +7,28 @@ |
||
7 | 7 |
|
8 | 8 |
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :class => 'form-horizontal' }) do |f| %> |
9 | 9 |
<%= devise_error_messages! %> |
10 |
+ <% if ENV['ON_HEROKU'] && User.count.zero? %> |
|
11 |
+ <div class="heroku-instructions"> |
|
12 |
+ <% app_name = request.host[/\A[^.]+/] %> |
|
13 |
+ <p>If you are the owner of this application, take the following steps to complete the setup:</p> |
|
14 |
+ |
|
15 |
+ <ul> |
|
16 |
+ <li>Read <a href="https://github.com/cantino/huginn/wiki/Run-Huginn-for-free-on-Heroku" target="_target">this document</a> carefully if you are going to try out Huginn for free on <a href="https://id.heroku.com/" target="_target">Heroku</a>.</li> |
|
17 |
+ |
|
18 |
+ <li>Install the <a href="https://toolbelt.heroku.com/" target="_target">Heroku Toolbelt</a> and run <kbd>heroku login</kbd> if you haven't already.</li> |
|
19 |
+ |
|
20 |
+ <li>Run the following commands:<br /> |
|
21 |
+ <%= content_tag :pre do -%> |
|
22 |
+heroku git:clone <%= content_tag :var, app_name %> |
|
23 |
+cd <%= content_tag :var, app_name %> |
|
24 |
+bundle |
|
25 |
+bin/setup_heroku |
|
26 |
+<%- end %> |
|
27 |
+ |
|
28 |
+ <li>Get back to this page and sign up with the invitation code shown by the last command.</li> |
|
29 |
+ </ul> |
|
30 |
+ </div> |
|
31 |
+ <% end %> |
|
10 | 32 |
|
11 | 33 |
<div class="form-group"> |
12 | 34 |
<%= f.label :invitation_code, :class => 'col-md-4 control-label' %> |
@@ -48,6 +48,7 @@ def set_value(key, value, options = {}) |
||
48 | 48 |
if $config[key].nil? || $config[key] == '' || ($config[key] != value && options[:force] != false) |
49 | 49 |
puts "Setting #{key} to #{value}" unless options[:silent] |
50 | 50 |
puts capture("heroku config:set #{key}=#{value}") |
51 |
+ $config[key] = value |
|
51 | 52 |
end |
52 | 53 |
end |
53 | 54 |
|
@@ -94,11 +95,15 @@ unless $config['APP_SECRET_TOKEN'] |
||
94 | 95 |
puts capture("heroku config:set APP_SECRET_TOKEN=`rake secret`") |
95 | 96 |
end |
96 | 97 |
|
98 |
+unless $config['DOMAIN'] |
|
99 |
+ set_value 'DOMAIN', "#{app_name}.herokuapp.com", force: false |
|
100 |
+ first_time = true |
|
101 |
+end |
|
102 |
+ |
|
97 | 103 |
set_value 'BUILDPACK_URL', "https://github.com/ddollar/heroku-buildpack-multi.git" |
98 | 104 |
set_value 'PROCFILE_PATH', "deployment/heroku/Procfile.heroku", force: false |
99 | 105 |
set_value 'ON_HEROKU', "true" |
100 | 106 |
set_value 'FORCE_SSL', "true" |
101 |
-set_value 'DOMAIN', "#{app_name}.herokuapp.com", force: false |
|
102 | 107 |
set_value 'USE_GRAPHVIZ_DOT', 'dot' |
103 | 108 |
|
104 | 109 |
unless $config['INVITATION_CODE'] |
@@ -133,6 +138,19 @@ unless $config['SMTP_DOMAIN'] && $config['SMTP_USER_NAME'] && $config['SMTP_PASS |
||
133 | 138 |
end |
134 | 139 |
end |
135 | 140 |
|
141 |
+if first_time |
|
142 |
+ puts "Restarting..." |
|
143 |
+ puts capture("heroku restart") |
|
144 |
+ |
|
145 |
+ puts "Done!" |
|
146 |
+ puts |
|
147 |
+ puts "Visit https://#{app_name}.herokuapp.com/users/sign_up and use the invitation code shown below:" |
|
148 |
+ puts |
|
149 |
+ puts "\t#{$config['INVITATION_CODE']}" |
|
150 |
+ |
|
151 |
+ exit |
|
152 |
+end |
|
153 |
+ |
|
136 | 154 |
branch = capture("git rev-parse --abbrev-ref HEAD") |
137 | 155 |
if yes?("Should I push your current branch (#{branch}) to heroku?") |
138 | 156 |
puts "This may take a moment..." |
@@ -158,4 +176,4 @@ if yes?("Should I push your current branch (#{branch}) to heroku?") |
||
158 | 176 |
end |
159 | 177 |
|
160 | 178 |
puts |
161 |
-puts "Done!" |
|
179 |
+puts "Done!" |